 

#include "includes.h"


int
main(int argc, char *argv[])
{

  test();

  load_main_lib();
  load_bytecode("program.gsmbc");

  int i;
  //clear task table
  for (i = 0; i < MAX_TASKS; i++)
    {
      task_table[i].ex_stack = task_table[i].ex_stack_start = task_table[i].ex_stack_limit = 0;
      task_table[i].op_stack = task_table[i].op_stack_start = task_table[i].op_stack_limit = 0;
      task_table[i].heap = task_table[i].heap_start = task_table[i].heap_limit = 0;
      task_table[i].msg = NULL;
      task_table[i].tid = TID_NONE;
      task_table[i].state = ST_NOTASK;
    }

  task_ptr = &task_table[0];
  
  num_tasks = 0;

  task_ptr->msg = (void *) 0x1;
  task_ptr->tid = 0;
  task_ptr->state = ST_SYSTEM;

  //This main task uses the execution stack provided by the OS.

  struct function_info *fi = function_lookup_by_id(0);

  create_task(&interpret, fi->bytecode_address, NULL);

  while(task_ptr->msg)
    {
      yield();
    }

  printf("Exiting Yellowjacket\n");

  return 0;
}
